This sample code shows the use of the Section Object. Modify the following sample code to fit your needs.
Private Sub Command1_Click()
On Error GoTo Command1_Click_Error
Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Dim crystalArea As CRPEAuto.Area
Dim crystalSection As CRPEAuto.Section
Dim lngSectionHeight As Long
Dim lngSectionWidth As Long
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Set crystalReport = crystalApplication.OpenReport _
("d:\crw\reports\craze\wwsales.rpt")
Set crystalArea = crystalReport.Areas.Item(1)
Set crystalSection = crystalArea.Sections(1)
lngSectionHeight = crystalSection.Height
lngSectionWidth = crystalSection.Width
MsgBox "In twips the Crystal section is " & _
Format(lngSectionHeight, "######") & " x " & _
Format(lngSectionWidth, "######")
Set crystalReport = Nothing
Set crystalArea = Nothing
Set crystalSection = Nothing
Kill "d:\crw\reports\xtreme\wwsales.rpt"
Command1_Click_Exit:
Exit Sub
Command1_Click_Error:
If crystalApplication Is Nothing Then
MsgBox "Unable to CreateObject(""Crystal.CRPE.Application"")"
GoTo Command1_Click_Exit
End If
If crystalReport Is Nothing Then
MsgBox "Unable to OpenReport(""d:\crw\reports\craze\wwsales.rpt"")"
GoTo Command1_Click_Exit
End If
MsgBox "Unknown error in Command1_Click routine"
GoTo Command1_Click_Exit
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |